import java.io.*;
import java.util.regex.*;

public class MyFilenameFilter 
	implements FilenameFilter
{
	File current = null;
	String regex = null;
	
	public MyFilenameFilter(File c, String reg)
	{
		current = c;
		regex = reg.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*");
	}
	
	public boolean accept(File dir, String name)
	{
		return (current.equals(dir)	&& Pattern.matches(regex, name));
	}
}
